package zx.x.modules.app.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import zx.x.common.utils.PageUtils;
import zx.x.common.utils.Query;

import zx.x.modules.app.dao.RoomAppointmentDao;
import zx.x.modules.app.dto.OrderDto;
import zx.x.modules.app.entity.RoomAppointmentEntity;
import zx.x.modules.app.service.RoomAppointmentService;


@Service("roomAppointmentService")
public class RoomAppointmentServiceImpl extends ServiceImpl<RoomAppointmentDao, RoomAppointmentEntity> implements RoomAppointmentService {

    @Autowired
    RoomAppointmentDao dao;

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        IPage<RoomAppointmentEntity> page = this.page(
                new Query<RoomAppointmentEntity>().getPage(params),
                new QueryWrapper<RoomAppointmentEntity>()
        );

        return new PageUtils(page);
    }

    @Override
    public RoomAppointmentEntity selectByYdTime(String ydTime,Integer roomId) {
        return dao.selectByYdTime(ydTime,roomId);
    }

    @Override
    public int cancelReservation(OrderDto dto) {
        return dao.cancelReservation(dto);
    }

}